home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Magazine Collection 2001
/
Delphi Magazine Collection 20001 (2001).iso
/
DISKS
/
Issue57
/
alfresco
/
tststr1.dpr
< prev
next >
Wrap
Text File
|
2000-04-02
|
922b
|
49 lines
program tststr1;
{$APPTYPE CONSOLE}
uses
Windows,
SysUtils;
function CountAlpha1(S : string) : integer;
var
i : integer;
begin
Result := 0;
for i := 1 to length(S) do
if (S[i] in ['A'..'Z','a'..'z']) then
inc(Result);
end;
function CountAlpha2(const S : string) : integer;
var
i : integer;
begin
Result := 0;
for i := 1 to length(S) do
if (S[i] in ['A'..'Z','a'..'z']) then
inc(Result);
end;
var
i : integer;
StartTime : DWORD;
begin
writeln('testing routine 1...');
StartTime := GetTickCount;
for i := 1 to 10000000 do
CountAlpha1('The cat sat on the mat');
writeln('time taken: ', GetTickCount - StartTime);
writeln('testing routine 2...');
StartTime := GetTickCount;
for i := 1 to 10000000 do
CountAlpha2('The cat sat on the mat');
writeln('time taken: ', GetTickCount - StartTime);
readln;
end.